using IM.Easy.Core.ServiceLifetime;
using IM.Easy.Core.Services;
using IM.Easy.Core.Utils;
using IM.Easy.Infrastructure.Query;
using IM.Easy.Entity.Msg;
using IM.Easy.MsgServices.Dtos;

namespace IM.Easy.MsgServices.IServices
{
    public interface IEmailsService : IAppServices<Emails>
    {
        /// <summary>
        /// 存草稿
        /// </summary>
        /// <param name="entity">要保存的实体</param>
        /// <returns>保存后的实体</returns>
        Emails Save(EmailsCreateDto entity);

        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="emailId"></param>
        /// <returns></returns>
        Emails Send(long emailId);

        /// <summary>
        /// 根据 ID 获取实体
        /// </summary>
        /// <param name="id">实体的唯一标识</param>
        /// <returns>获取的实体</returns>
        Emails GetById(int id);

        /// <summary>
        /// 获取所有实体
        /// </summary>
        /// <returns>所有实体的列表</returns>
        PageResponse<EmailsDto> GetPageList(EmailsQueryDto query);

        /// <summary>
        /// 更新一个已有的实体
        /// </summary>
        /// <param name="entity">更新后的实体</param>
        /// <returns>更新后的实体</returns>
        bool Update(Emails entity);

        /// <summary>
        /// 根据 ID 删除实体
        /// </summary>
        /// <param name="id">要删除的实体的唯一标识</param>
        /// <returns>操作是否成功</returns>
        bool Delete(params int[] key);

        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool SendEmail(Emails entity);

        /// <summary>
        /// 获取收件人ID
        /// </summary>
        /// <param name="emailId"></param>
        /// <returns></returns>
        List<long> GetAudinceUserId(long emailId);
    }
}
